<template>
	<view class="container">
		<view class="detail_content">
			<u-cell-group>
				<u-cell size="large" title="电表号" label="描述信息">
					<view slot="label">
						<text class="meter_no">{{currentMeter.electricityNo}}</text>
					</view>
					<view slot="value">
						<u-tag v-if="currentMeter.status===1" text="使用中" type="success"></u-tag>
						<u-tag v-if="currentMeter.status===2" text="已停用" type="error"></u-tag>
					</view>
				</u-cell>
				<u-cell size="large" title="更新后编号" :label="currentMeter.projectUpdateNumber || '—— ——'"></u-cell>
				<u-cell size="large" title="项目名称" :label="currentMeter.projectName || '—— ——'"></u-cell>
				<u-cell size="large" title="业主" :label="currentMeter.ownerName || '—— ——'"></u-cell>
				<u-cell size="large" title="运营商" :label="currentMeter.operator || '—— ——'"></u-cell>
				<u-cell size="large" title="最近一次抄表时间" :label="currentMeter.newData || '—— ——'"></u-cell>
				<u-cell size="large" title="最近一次抄表度数" :label="currentMeter.newDegree || '—— ——'"></u-cell>
				<u-cell size="large" title="最近一次上期度数" :label="currentMeter.newBeforeDegree || '—— ——'"></u-cell>
				<u-cell size="large" title="业主最近结算时间" :label="currentMeter.newOwner || '—— ——'"></u-cell>
				<u-cell size="large" title="运营商最近结算时间" :label="currentMeter.newOperator || '—— ——'"></u-cell>
				<u-cell size="large" title="初始度数" :label="String(currentMeter.initialElectricity)"></u-cell>
				<u-cell size="large" title="父级电表" :label="currentMeter.parentName || '—— ——'"></u-cell>
				<u-cell size="large" title="品牌" :label="currentMeter.brand || '—— ——'"></u-cell>
				<u-cell size="large" title="型号" :label="currentMeter.models || '—— ——'"></u-cell>
				<u-cell size="large" title="位置" :label="currentMeter.location|| '—— ——'"></u-cell>
			</u-cell-group>
		</view>
		<uni-fab :pattern="pattern" :content="content" horizontal="right" direction="vertical"
			@trigger="trigger"></uni-fab>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				currentMeter: {},
				pattern: {
					icon: 'more-filled'
				},
				content: [{
						text: '去抄表',
						iconPath: '../../static/icon_imgs/dianfeijiaofei.png'
					},
					{
						text: '抄表记录',
						iconPath: '../../static/icon_imgs/hetongxuqianshenqing.png'
					},
				]
			}
		},
		onLoad(options) {
			this.currentMeter = JSON.parse(options.data)
		},
		methods: {
			trigger(e) {
				switch (e.index) {
					case 0:
						uni.redirectTo({
							url: `/pages/meter/meterSend?data=${JSON.stringify(this.currentMeter)}`
						})
						break;
					case 1:
						uni.redirectTo({
							url: `/pages/meter/sendRecords?data=${JSON.stringify(this.currentMeter)}`
						})
						break;
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.container {
		position: fixed;
		left: 0;
		right: 0;
		top: 0;
		bottom: 0;
		padding: 20rpx;
		overflow: auto;

		.meter_no {
			font-size: 32rpx;
			font-weight: 700;
			color: #0050b3;
		}
	}
</style>